package
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Loader;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.IOErrorEvent;
	import flash.events.ProgressEvent;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import flash.net.Socket;
	import flash.net.URLRequest;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.utils.ByteArray;


	[SWF(frameRate="24", width="1024", height="768", backgroundColor="0xffffff")]

	public class Mywww extends Sprite
	{
		private var now:Date=new Date();
		private var txt:TextField=new TextField();
		private var TF:TextFormat=new TextFormat();

		private var _socket:Socket=new Socket();


		public var url:String=new String("up.png");
		public var loader:Loader=new Loader();
		public var bitmapdata:BitmapData
		public var bytearr:ByteArray=new ByteArray();
		public var bytemap:Bitmap=new Bitmap();
		public var newmap:Bitmap=new Bitmap();

		public function Mywww()
		{
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandle);
			loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandle);
			loader.load(new URLRequest(url));


			Init();
		}
		private var a:uint;

		private function goon(e:Event):void
		{
			txt.htmlText=String(now);

			trace(a++);
		}

		public function errorHandle(evt:IOErrorEvent):void
		{
			trace("error");
		}

		private function Init():void
		{
			_socket.addEventListener(Event.CONNECT, ConnectedFunc);
			_socket.addEventListener(Event.CLOSE, CloseFunc);
			_socket.addEventListener(IOErrorEvent.IO_ERROR, IoerrorFunc);
			_socket.addEventListener(ProgressEvent.SOCKET_DATA, SocketdataFunc);
		}

		private function ConnectedFunc(evt:Event):void
		{

		}

		private function CloseFunc(evt:Event):void
		{

		}

		private function IoerrorFunc(evt:IOErrorEvent):void
		{

		}

		private function SocketdataFunc(evt:ProgressEvent):void
		{

		}

		public function completeHandle(evt:Event):void
		{
			var mc:MovieClip=loader.content as MovieClip;
			if(mc){
				this.addChild(mc);
			}else{
				trace("转化失败");
			}
		this.addChild(loader);
		}
	}
}
